
{% extends "admin/common/layout.html" %}
{% block active %}role{% endblock %}
{% block body %}
<h2>角色管理</h2>
{% include "admin/common/flash.html" %}
{% include "admin/role/nav.html" %}
<form class="form-horizontal" role="form" method="POST">
    <div class="form-group">
        <label for="name" class="col-sm-2 control-label">角色</label>
        <div class="col-sm-10">
            <input type="text" class="form-control" id="name" name="name" placeholder="请输入角色" value="{{ role.name }}">
        </div>
    </div>

    <div class="form-group">
        <label for="menu_ids" class="col-sm-2 control-label">菜单JSON</label>
        <div class="col-sm-10">
            {% for k, item in menus.items() %}
            <div class="checkbox col-sm-3">
                <label>
                    <input type="checkbox" name="menu_ids" value="{{ item.id }}" {% if item.id|string in role.menu_id_list %} checked {% endif %} /> {{ item.name }}
                </label>
            </div>
            {% endfor %}
        </div>
    </div>

    <div class="form-group">
        <div class="col-sm-offset-2 col-sm-10" role="toolbar" aria-label="...">
            <div class="btn-group" role="group">
                <button type="submit" class="btn btn-default">保存</button>
            </div>
        </div>
    </div>
</form>
{% endblock %}
